﻿#ifndef IOQUEUE_H
#define IOQUEUE_H

#include <QObject>

#include "global.h"

extern "C"{
#include <libavformat/avformat.h>
}

class ioQueuePrivate;

/**
 * @class	ioQueue ioQueue.h ioQueue.h
 *
 * @brief	Queue of i/oes.
 *
 * @author	戴华豪
 * @date	2015/8/2
 */
class ioQueue : public QObject
{
    Q_OBJECT
public:
    explicit ioQueue(QObject *parent = 0);
	~ioQueue();

    void clear();

public:

    /**
     * @fn	void ioQueue::appendQueue(MediaType mt, int streamIndex);
     *
     * @brief	添加一个mt类型的队列
     *
     * @author	戴华豪
     * @date	2015/8/2
     *
	 * @param	mt				队列的媒体类型
     * @param	streamIndex     队列代表的stream在文件中的索引
     */
    void appendQueue(MediaType mt, int streamIndex);

    /**
     * @fn	void ioQueue::enqueue(AVPacket *pkt);
     *
     * @brief	Adds an object onto the end of this queue.
     *
     * @author	戴华豪
     * @date	2015/8/2
     *
     * @param [in]	pkt	If non-null, the packet.
     */
    void enqueue(AVPacket *pkt);

    AVPacket *popup(int streamIndex);

signals:

public slots:

private:
    ioQueuePrivate *d;
};

#endif // IOQUEUE_H
